<?php
require_once '../libs/app.config.php';
session_start ();
if ($_SESSION ['LoginId'] == false) {
	header ( "Location:login.php" );
}
($charset == 'zh_CN') ? $charset = 'cn' : null;

if ($_POST) {
	$searchID = $_POST['searchID'];
	$sql = sprintf('select orderId, status from orders where orderId = "%s"', $searchID);
	$query = $tpm->query ($sql);
	$rows = $tpm->fetch_array ( $query );
	$direcLink = ($rows['status'] == "ongoing") ? "ongoing_order_records.php" : "complete_order_records.php";
	if ($tpm->affected_rows($query))
		echo "<script>alert('Order Found!');location.href=('{$direcLink}?searchId={$searchID}');</script>";
	else 
		echo "<script>alert('Order Not Found!');</script>";
}
// print_r($list);exit();
require_once (INCLUDE_PATH . 'template.inc.php'); // 模板类及对象$tpl的加载
$tpl->assign ( "searchID", $searchID );
$tpl->display ( "search_order.html" );
?>

